<?php
/**
 * +----------------------------------------------------------------------
 * | Copyright © Sogu Technologies Co. Ltd 2018-2050 All rights reserved.
 * +----------------------------------------------------------------------
 * | File name: CollectionRequest.php
 * +----------------------------------------------------------------------
 * | Author: lijiafei
 * +----------------------------------------------------------------------
 * | Description:
 * +----------------------------------------------------------------------
 * | Others: 其他内容的说明
 * +----------------------------------------------------------------------
 * | History:
 * +----------------------------------------------------------------------
 * | 1.Date: 2019/2/26 Author: lijiafei Modification: 创建
 * +----------------------------------------------------------------------
 */

namespace App\Library\Traits;


use GuzzleHttp\Client;

trait RepayBuckle
{

    public function request($url,$data,$method = 'POST')
    {
        $client = new Client(['base_uri' => $this->base_buckle_uri, 'timeout' => 30.0]);
        \Log::debug('还款:裸扣请求数据:' . json_encode($data, JSON_UNESCAPED_UNICODE|JSON_UNESCAPED_SLASHES));
        $result = $client->request($method, $url, ['json' => $data, 'verify' => false]);
        return json_decode($result->getBody()->getContents(), true);
    }
}